/*package cn.ylhx.venue.mobilePay.controller;

import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.bind.annotation.RequestMapping;

public class Pay {
	
	/**
     * 预下单(对于已经产生的订单)
     * @Author    张志朋
     * @param request
     * @param response
     * @return
     * @throws Exception  String
     * @Date    2017年1月17日
     * 更新日志
     * 2017年1月17日 张志朋  首次创建
     *
     */
 /*   @SuppressWarnings("rawtypes")
    @RequestMapping(value = "dopay")
    public String dopay(HttpServletRequest request, HttpServletResponse response) throws Exception {
        //其实这里只要传递一个订单编号即可
        String state = request.getParameter("state");
        String[] split = state.split("CUT");
        String totalFee = split[0];
        String orderNo = split[1];
        //获取code 这个在微信支付调用时会自动加上这个参数 无须设置
        String code = request.getParameter("code");
        //获取用户openID(JSAPI支付必须传openid)
        String openId = MobileUtil.getOpenId(code);
        String notify_url = "http://weixin.52itstyle.com/pay/weixinMobile/WXPayBack";//回调接口
        String trade_type = "JSAPI";// 交易类型H5支付
        SortedMap<Object, Object> packageParams = new TreeMap<Object, Object>();
        ConfigUtil.commonParams(packageParams);
        packageParams.put("body","测试微信H5支付");// 商品描述
        packageParams.put("out_trade_no", orderNo);// 商户订单号
        packageParams.put("total_fee", totalFee);// 总金额
        packageParams.put("spbill_create_ip", "127.0.0.1");// 发起人IP地址
        packageParams.put("notify_url", notify_url);// 回调地址
        packageParams.put("trade_type", trade_type);// 交易类型
        packageParams.put("openid", openId);//用户openID
        String sign = PayCommonUtil.createSign("UTF-8", packageParams,ConfigUtil.API_KEY);
        packageParams.put("sign", sign);// 签名
        String requestXML = PayCommonUtil.getRequestXml(packageParams);
        String resXml = HttpUtil.postData(ConfigUtil.UNIFIED_ORDER_URL, requestXML);
        Map map = XMLUtil.doXMLParse(resXml);
        String returnCode = (String) map.get("return_code");
        String returnMsg = (String) map.get("return_msg");
        String url ="";
        if("SUCCESS".equals(returnCode)){
            String resultCode = (String) map.get("result_code");
            String errCodeDes = (String) map.get("err_code_des");
            if("SUCCESS".equals(resultCode)){
                //获取预支付交易会话标识
                String prepay_id = (String) map.get("prepay_id");
                String prepay_id2 = "prepay_id=" + prepay_id;
                String packages = prepay_id2;
                SortedMap<Object, Object> finalpackage = new TreeMap<Object, Object>();
                String timestamp = DateUtil.getTimestamp();
                String nonceStr = packageParams.get("nonce_str").toString();
                finalpackage.put("appId",  ConfigUtil.APP_ID);
                finalpackage.put("timeStamp", timestamp);
                finalpackage.put("nonceStr", nonceStr);
                finalpackage.put("package", packages);  
                finalpackage.put("signType", "MD5");
                //这里很重要  参数一定要正确 狗日的腾讯 参数到这里就成大写了
                //可能报错信息(支付验证签名失败 get_brand_wcpay_request:fail)
                sign = PayCommonUtil.createSign("UTF-8", finalpackage,ConfigUtil.API_KEY);
                url = "redirect:/weixinMobile/pay?timeStamp="
                        + timestamp
                        + "&nonceStr=" + nonceStr + "&package=" + packages
                        + "&signType=MD5" + "&paySign=" + sign
                        +"&appid="+ ConfigUtil.APP_ID;
            }else{
                LogUtil.info("订单号:"+orderNo+"错误信息:"+errCodeDes);
                url = "redirect:/weixinMobile/error?code=0";//该订单已支付
            }
        }else{
            LogUtil.info("订单号:"+orderNo+"错误信息:"+returnMsg);
            url = "redirect:/weixinMobile/error?code=1";//系统系统
        }
        return url;
    }
}*/
